package cn.edu.scau.cmi.dengzejun.chapter11;

import java.awt.*;
import javax.swing.*;
import javax.swing.event.*;
import java.awt.event.*;

public class WindowDocument extends JFrame{
	JTextArea inputText,showText;
	PoliceListenForEight listen;
	WindowDocument(){
		this.init();
		this.setLayout(new FlowLayout());
		this.setVisible(true);
		this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		return;
	}
	
	private void init() {
		this.inputText = new JTextArea(6,8);
		this.showText = new JTextArea(6,8);
		this.add(new JScrollPane(this.inputText));
		this.add(new JScrollPane(this.showText));
		this.listen = new PoliceListenForEight();
		this.listen.setInputText(this.inputText);
		this.listen.setShowText(this.showText);
		(this.inputText.getDocument()).addDocumentListener(this.listen);
		return;
	}
}
